package com.itheima.health.controller;

import com.itheima.health.common.MessageConst;
import com.itheima.health.entity.Result;
import com.itheima.health.pojo.Role;
import com.itheima.health.service.RoleService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("role")
@Slf4j
public class RoleController {

    @DubboReference
    private RoleService roleService;

    @GetMapping("findAll")
    public Result findAll() {
        List<Role> roleList = roleService.findAll();
        return new Result(true, MessageConst.ACTION_SUCCESS, roleList);
    }
}
